//6 2 7 7 9 3 2 1 3 11 4
//2
// 其实这道题就像是, 多少个桶, 装下多少个球, 求桶的最小容量
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let initArr = [];
let n;
rl.on("line", (line)=>{
    if(initArr.length === 0) {
        initArr = line.trim().split(/\s+/).map(Number)
    } else if(n === undefined) {
        n = Number(line.trim())
        console.log(getResult(initArr, n))

        // clear
        initArr.length = 0
        n = undefined
    }

})

function getResult(initArr, n) {
    initArr.sort((a, b) => a - b)
    let total = initArr.reduce((acc, num) => acc + num, 0)
    let min = Math.floor(total/n)
    let max = total
    let ans = total
    while(min <= max) {
        let mid = Math.floor((min + max)/2)
        if(valid(initArr, n, mid)) {
            ans = Math.min(mid, ans)
            max = mid - 1
        } else {
            min = mid + 1
        }
    }
    return ans
}

function valid(initArr, n, mid) {
    let ans = true
    let dp = new Array(n).fill(mid)
    for (const num of initArr) {
        let flag = true
        for (const i in dp) {
            let current = dp[i]
            if(current >= num) {
                dp[i]-=num
                flag = !flag
                break
            }
        }
        if(flag) {
           return false
        }

    }

    return ans
}
